package com.it.zhangjun.config;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;

/**
 * 配置测试类
 *
 * @author: z00018123
 * @date: 2021/5/10
 **/
public class ConfigTest {
    public static void main(String[] args) throws Exception {
        Configuration configuration = new PropertiesConfiguration("1.properties");
        System.out.println(configuration.getString("common.name"));
        //打印include内容
        System.out.println(configuration.getString("java.version"));
        System.out.println("======");
        //获得一个子配置类
        Configuration subConfiguration = configuration.subset("common");
        subConfiguration.getKeys().forEachRemaining(k->{
            System.out.println(k +"-->"+subConfiguration.getString(k));
        });
    }
}
